Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/EventInfoSheet.kt 01cd54907d62cd90913d3d071b6bc240cae365ef (01cd5490) Text, 8.76 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.ui.component

Tff7b72import T7ee787androidx.compose.foundation.background
Tff7b72import T7ee787androidx.compose.foundation.clickable
Tff7b72import T7ee787androidx.compose.foundation.layout.Arrangement
Tff7b72import T7ee787androidx.compose.foundation.layout.Column
Tff7b72import T7ee787androidx.compose.foundation.layout.Row
Tff7b72import T7ee787androidx.compose.foundation.layout.fillMaxWidth
Tff7b72import T7ee787androidx.compose.foundation.layout.padding
Tff7b72import T7ee787androidx.compose.foundation.layout.size
Tff7b72import T7ee787androidx.compose.foundation.rememberScrollState
Tff7b72import T7ee787androidx.compose.foundation.selection.toggleable
Tff7b72import T7ee787androidx.compose.foundation.shape.CircleShape
Tff7b72import T7ee787androidx.compose.foundation.verticalScroll
Tff7b72import T7ee787androidx.compose.material3.ExperimentalMaterial3Api
Tff7b72import T7ee787androidx.compose.material3.HorizontalDivider
Tff7b72import T7ee787androidx.compose.material3.Icon
Tff7b72import T7ee787androidx.compose.material3.MaterialTheme
Tff7b72import T7ee787androidx.compose.material3.ModalBottomSheet
Tff7b72import T7ee787androidx.compose.material3.Switch
Tff7b72import T7ee787androidx.compose.material3.Text
Tff7b72import T7ee787androidx.compose.material3.rememberModalBottomSheetState
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.ui.Alignment
Tff7b72import T7ee787androidx.compose.ui.Modifier
Tff7b72import T7ee787androidx.compose.ui.draw.clip
Tff7b72import T7ee787androidx.compose.ui.graphics.Color
Tff7b72import T7ee787androidx.compose.ui.graphics.luminance
Tff7b72import T7ee787androidx.compose.ui.graphics.vector.ImageVector
Tff7b72import T7ee787androidx.compose.ui.platform.LocalUriHandler
Tff7b72import T7ee787androidx.compose.ui.semantics.Role
Tff7b72import T7ee787androidx.compose.ui.semantics.heading
Tff7b72import T7ee787androidx.compose.ui.semantics.semantics
Tff7b72import T7ee787androidx.compose.ui.unit.dp
Tff7b72import T7ee787org.jetbrains.compose.resources.stringResource
Tff7b72import T7ee787org.meshtastic.core.model.EventFirmwareEdition
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.event_use_event_theme
Tff7b72import T7ee787org.meshtastic.core.ui.icon.CalendarMonth
Tff7b72import T7ee787org.meshtastic.core.ui.icon.ChevronRight
Tff7b72import T7ee787org.meshtastic.core.ui.icon.LinkIcon
Tff7b72import T7ee787org.meshtastic.core.ui.icon.MeshtasticIcons
Tff7b72import T7ee787org.meshtastic.core.ui.icon.Place
Tff7b72import T7ee787org.meshtastic.core.ui.theme.LocalEventThemeToggle
Tff7b72import T7ee787org.meshtastic.core.ui.util.EventBrandingIcon
Tff7b72import T7ee787org.meshtastic.core.ui.util.accentColorOrNull

T8b949e/**
* Bottom sheet shown when the user taps the event branding in [MainAppBar]. Surfaces the event metadata the bundled
* `event_firmware.json` carries — welcome message, location, dates, and links — themed with the edition's accent color.
*/
Tf0883e@OptInTb4b4b4(Te6edf3ExperimentalMaterial3ApiTff7b72::Te6edf3classTb4b4b4)
Tf0883e@Composable
Tff7b72fun Td2a8ffEventInfoSheetTb4b4b4(Te6edf3editionTb4b4b4: Te6edf3EventFirmwareEditionTb4b4b4, Te6edf3onDismissTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3sheetState Tff7b72= Te6edf3rememberModalBottomSheetStateTb4b4b4(Te6edf3skipPartiallyExpanded Tff7b72= Tff7b72trueTb4b4b4)
Tff7b72val Te6edf3uriHandler Tff7b72= Te6edf3LocalUriHandlerTb4b4b4.Te6edf3current
Tff7b72val Te6edf3accent Tff7b72= Te6edf3editionTb4b4b4.Te6edf3accentColorOrNullTb4b4b4(Tb4b4b4)

Te6edf3ModalBottomSheetTb4b4b4(Te6edf3onDismissRequest Tff7b72= Te6edf3onDismissTb4b4b4, Te6edf3sheetState Tff7b72= Te6edf3sheetStateTb4b4b4) Tb4b4b4{
Te6edf3ColumnTb4b4b4(Te6edf3ModifierTb4b4b4.Te6edf3fillMaxWidthTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3verticalScrollTb4b4b4(Te6edf3rememberScrollStateTb4b4b4(Tb4b4b4)Tb4b4b4)Tb4b4b4.Te6edf3paddingTb4b4b4(Te6edf3bottom Tff7b72= T79c0ff2T79c0ff4.Te6edf3dpTb4b4b4)Tb4b4b4) Tb4b4b4{
Te6edf3EventHeaderTb4b4b4(Te6edf3editionTb4b4b4, Te6edf3accentTb4b4b4)

Te6edf3ColumnTb4b4b4(
Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3paddingTb4b4b4(Te6edf3horizontal Tff7b72= T79c0ff2T79c0ff4.Te6edf3dpTb4b4b4, Te6edf3vertical Tff7b72= T79c0ff1T79c0ff6.Te6edf3dpTb4b4b4)Tb4b4b4,
Te6edf3verticalArrangement Tff7b72= Te6edf3ArrangementTb4b4b4.Te6edf3spacedByTb4b4b4(T79c0ff1T79c0ff6.Te6edf3dpTb4b4b4)Tb4b4b4,
Tb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3editionTb4b4b4.Te6edf3welcomeMessageTb4b4b4.Te6edf3isNotBlankTb4b4b4(Tb4b4b4)Tb4b4b4) Tb4b4b4{
Te6edf3TextTb4b4b4(Te6edf3text Tff7b72= Te6edf3editionTb4b4b4.Te6edf3welcomeMessageTb4b4b4, Te6edf3style Tff7b72= Te6edf3MaterialThemeTb4b4b4.Te6edf3typographyTb4b4b4.Te6edf3bodyLargeTb4b4b4)
Tb4b4b4}

Tff7b72val Te6edf3iconTint Tff7b72= Te6edf3accent Tff7b72?: Te6edf3MaterialThemeTb4b4b4.Te6edf3colorSchemeTb4b4b4.Te6edf3onSurfaceVariant
Te6edf3editionTb4b4b4.Te6edf3locationTff7b72?.Te6edf3takeIf Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3isNotBlankTb4b4b4(Tb4b4b4) Tb4b4b4}Tff7b72?.Te6edf3let Tb4b4b4{ Te6edf3InfoRowTb4b4b4(Te6edf3MeshtasticIconsTb4b4b4.Te6edf3PlaceTb4b4b4, Tffa657itTb4b4b4, Te6edf3iconTintTb4b4b4) Tb4b4b4}
Te6edf3dateRangeTb4b4b4(Te6edf3editionTb4b4b4)Tff7b72?.Te6edf3let Tb4b4b4{ Te6edf3InfoRowTb4b4b4(Te6edf3MeshtasticIconsTb4b4b4.Te6edf3CalendarMonthTb4b4b4, Tffa657itTb4b4b4, Te6edf3iconTintTb4b4b4) Tb4b4b4}

Tff7b72val Te6edf3links Tff7b72= Te6edf3editionTb4b4b4.Te6edf3linksTb4b4b4.Te6edf3filter Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3urlTb4b4b4.Te6edf3isNotBlankTb4b4b4(Tb4b4b4) Tb4b4b4}
Tff7b72if Tb4b4b4(Te6edf3linksTb4b4b4.Te6edf3isNotEmptyTb4b4b4(Tb4b4b4)Tb4b4b4) Tb4b4b4{
Te6edf3HorizontalDividerTb4b4b4(Tb4b4b4)
Te6edf3linksTb4b4b4.Te6edf3forEach Tb4b4b4{ Te6edf3link Tff7b72-Tff7b72>
Te6edf3LinkRowTb4b4b4(Te6edf3label Tff7b72= Te6edf3linkTb4b4b4.Te6edf3labelTb4b4b4.Te6edf3ifBlank Tb4b4b4{ Te6edf3linkTb4b4b4.Te6edf3url Tb4b4b4}Tb4b4b4, Te6edf3tint Tff7b72= Te6edf3iconTintTb4b4b4) Tb4b4b4{
Te6edf3uriHandlerTb4b4b4.Te6edf3openUriTb4b4b4(Te6edf3linkTb4b4b4.Te6edf3urlTb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}

T8b949e// Opt-out for the ambient event theme (accent wash + app-wide fonts). Always shown — the sheet only
T8b949e// opens for an active event, so there's always a theme to govern.
Tff7b72val Te6edf3themeToggle Tff7b72= Te6edf3LocalEventThemeToggleTb4b4b4.Te6edf3current
Te6edf3HorizontalDividerTb4b4b4(Tb4b4b4)
Te6edf3RowTb4b4b4(
Te6edf3modifier Tff7b72=
Te6edf3ModifierTb4b4b4.Te6edf3fillMaxWidthTb4b4b4(Tb4b4b4)
Tb4b4b4.Te6edf3toggleableTb4b4b4(
Te6edf3value Tff7b72= Te6edf3themeToggleTb4b4b4.Te6edf3enabledTb4b4b4,
Te6edf3onValueChange Tff7b72= Te6edf3themeToggleTb4b4b4.Te6edf3onChangeTb4b4b4,
Te6edf3role Tff7b72= Te6edf3RoleTb4b4b4.Te6edf3SwitchTb4b4b4,
Tb4b4b4)Tb4b4b4,
Te6edf3horizontalArrangement Tff7b72= Te6edf3ArrangementTb4b4b4.Te6edf3spacedByTb4b4b4(T79c0ff1T79c0ff2.Te6edf3dpTb4b4b4)Tb4b4b4,
Te6edf3verticalAlignment Tff7b72= Te6edf3AlignmentTb4b4b4.Te6edf3CenterVerticallyTb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3TextTb4b4b4(
Te6edf3text Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3event_use_event_themeTb4b4b4)Tb4b4b4,
Te6edf3style Tff7b72= Te6edf3MaterialThemeTb4b4b4.Te6edf3typographyTb4b4b4.Te6edf3bodyMediumTb4b4b4,
Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3weightTb4b4b4(T79c0ff1fTb4b4b4)Tb4b4b4,
Tb4b4b4)
T8b949e// Row owns the toggle; null keeps the Switch visual-only (no double-fire).
Te6edf3SwitchTb4b4b4(Te6edf3checked Tff7b72= Te6edf3themeToggleTb4b4b4.Te6edf3enabledTb4b4b4, Te6edf3onCheckedChange Tff7b72= Tff7b72nullTb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}

T8b949e/** Accent-colored header band with the event icon + display name; falls back to the theme surface when no accent. */
Tf0883e@Composable
Tff7b72private Tff7b72fun Td2a8ffEventHeaderTb4b4b4(Te6edf3editionTb4b4b4: Te6edf3EventFirmwareEditionTb4b4b4, Te6edf3accentTb4b4b4: Te6edf3Color?Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3background Tff7b72= Te6edf3accent Tff7b72?: Te6edf3MaterialThemeTb4b4b4.Te6edf3colorSchemeTb4b4b4.Te6edf3surfaceVariant
Tff7b72val Te6edf3foreground Tff7b72= Te6edf3accentTff7b72?.Te6edf3contentColorForTb4b4b4(Tb4b4b4) Tff7b72?: Te6edf3MaterialThemeTb4b4b4.Te6edf3colorSchemeTb4b4b4.Te6edf3onSurfaceVariant
Te6edf3RowTb4b4b4(
Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3fillMaxWidthTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3backgroundTb4b4b4(Te6edf3backgroundTb4b4b4)Tb4b4b4.Te6edf3paddingTb4b4b4(T79c0ff2T79c0ff4.Te6edf3dpTb4b4b4)Tb4b4b4,
Te6edf3horizontalArrangement Tff7b72= Te6edf3ArrangementTb4b4b4.Te6edf3spacedByTb4b4b4(T79c0ff1T79c0ff6.Te6edf3dpTb4b4b4)Tb4b4b4,
Te6edf3verticalAlignment Tff7b72= Te6edf3AlignmentTb4b4b4.Te6edf3CenterVerticallyTb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3EventBrandingIconTb4b4b4(
Te6edf3edition Tff7b72= Te6edf3editionTb4b4b4,
Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3sizeTb4b4b4(T79c0ff4T79c0ff8.Te6edf3dpTb4b4b4)Tb4b4b4.Te6edf3clipTb4b4b4(Te6edf3CircleShapeTb4b4b4)Tb4b4b4,
Te6edf3contentDescription Tff7b72= Tff7b72nullTb4b4b4,
Tb4b4b4)
Te6edf3TextTb4b4b4(
Te6edf3text Tff7b72= Te6edf3editionTb4b4b4.Te6edf3displayNameTb4b4b4,
Te6edf3style Tff7b72= Te6edf3MaterialThemeTb4b4b4.Te6edf3typographyTb4b4b4.Te6edf3headlineSmallTb4b4b4,
Te6edf3color Tff7b72= Te6edf3foregroundTb4b4b4,
Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3semantics Tb4b4b4{ Te6edf3headingTb4b4b4(Tb4b4b4) Tb4b4b4}Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Tf0883e@Composable
Tff7b72private Tff7b72fun Td2a8ffInfoRowTb4b4b4(Te6edf3iconTb4b4b4: Te6edf3ImageVectorTb4b4b4, Te6edf3textTb4b4b4: Tffa657StringTb4b4b4, Te6edf3tintTb4b4b4: Te6edf3ColorTb4b4b4) Tb4b4b4{
Te6edf3RowTb4b4b4(Te6edf3horizontalArrangement Tff7b72= Te6edf3ArrangementTb4b4b4.Te6edf3spacedByTb4b4b4(T79c0ff1T79c0ff2.Te6edf3dpTb4b4b4)Tb4b4b4, Te6edf3verticalAlignment Tff7b72= Te6edf3AlignmentTb4b4b4.Te6edf3CenterVerticallyTb4b4b4) Tb4b4b4{
Te6edf3IconTb4b4b4(Te6edf3imageVector Tff7b72= Te6edf3iconTb4b4b4, Te6edf3contentDescription Tff7b72= Tff7b72nullTb4b4b4, Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3sizeTb4b4b4(T79c0ff2T79c0ff0.Te6edf3dpTb4b4b4)Tb4b4b4, Te6edf3tint Tff7b72= Te6edf3tintTb4b4b4)
Te6edf3TextTb4b4b4(Te6edf3text Tff7b72= Te6edf3textTb4b4b4, Te6edf3style Tff7b72= Te6edf3MaterialThemeTb4b4b4.Te6edf3typographyTb4b4b4.Te6edf3bodyMediumTb4b4b4)
Tb4b4b4}
Tb4b4b4}

Tf0883e@Composable
Tff7b72private Tff7b72fun Td2a8ffLinkRowTb4b4b4(Te6edf3labelTb4b4b4: Tffa657StringTb4b4b4, Te6edf3tintTb4b4b4: Te6edf3ColorTb4b4b4, Te6edf3onClickTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4) Tb4b4b4{
Te6edf3RowTb4b4b4(
Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3fillMaxWidthTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3clickableTb4b4b4(Te6edf3onClick Tff7b72= Te6edf3onClickTb4b4b4)Tb4b4b4.Te6edf3paddingTb4b4b4(Te6edf3vertical Tff7b72= T79c0ff4.Te6edf3dpTb4b4b4)Tb4b4b4,
Te6edf3horizontalArrangement Tff7b72= Te6edf3ArrangementTb4b4b4.Te6edf3spacedByTb4b4b4(T79c0ff1T79c0ff2.Te6edf3dpTb4b4b4)Tb4b4b4,
Te6edf3verticalAlignment Tff7b72= Te6edf3AlignmentTb4b4b4.Te6edf3CenterVerticallyTb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3IconTb4b4b4(
Te6edf3imageVector Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3LinkIconTb4b4b4,
Te6edf3contentDescription Tff7b72= Tff7b72nullTb4b4b4,
Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3sizeTb4b4b4(T79c0ff2T79c0ff0.Te6edf3dpTb4b4b4)Tb4b4b4,
Te6edf3tint Tff7b72= Te6edf3tintTb4b4b4,
Tb4b4b4)
Te6edf3TextTb4b4b4(Te6edf3text Tff7b72= Te6edf3labelTb4b4b4, Te6edf3style Tff7b72= Te6edf3MaterialThemeTb4b4b4.Te6edf3typographyTb4b4b4.Te6edf3bodyMediumTb4b4b4, Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3weightTb4b4b4(T79c0ff1fTb4b4b4)Tb4b4b4)
Te6edf3IconTb4b4b4(
Te6edf3imageVector Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3ChevronRightTb4b4b4,
Te6edf3contentDescription Tff7b72= Tff7b72nullTb4b4b4,
Te6edf3tint Tff7b72= Te6edf3MaterialThemeTb4b4b4.Te6edf3colorSchemeTb4b4b4.Te6edf3onSurfaceVariantTb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

T8b949e/** Dates as displayed: a `start – end` range, a single date, or `null` when neither is set. Raw ISO (no l10n parse). */
Tff7b72private Tff7b72fun Td2a8ffdateRangeTb4b4b4(Te6edf3editionTb4b4b4: Te6edf3EventFirmwareEditionTb4b4b4)Tb4b4b4: Tffa657String? Tb4b4b4{
Tff7b72val Te6edf3start Tff7b72= Te6edf3editionTb4b4b4.Te6edf3eventStart
Tff7b72val Te6edf3end Tff7b72= Te6edf3editionTb4b4b4.Te6edf3eventEnd
Tff7b72return Tff7b72when Tb4b4b4{
Te6edf3start Tff7b72!Tff7b72= Tff7b72null Tff7b72&Tff7b72& Te6edf3end Tff7b72!Tff7b72= Tff7b72null Tff7b72&Tff7b72& Te6edf3start Tff7b72!Tff7b72= Te6edf3end Tff7b72-Tff7b72> Ta5d6ff"Tffd700$Te6edf3startTa5d6ff – Tffd700$Te6edf3endTa5d6ff"
Te6edf3start Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3start
Tff7b72else Tff7b72-Tff7b72> Te6edf3end
Tb4b4b4}
Tb4b4b4}

T8b949e/** Black or white, whichever reads against this background color. */
Tff7b72private Tff7b72fun Te6edf3ColorTb4b4b4.Td2a8ffcontentColorForTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3Color Tff7b72= Tff7b72if Tb4b4b4(Te6edf3luminanceTb4b4b4(Tb4b4b4) Tff7b72> Te6edf3LUMINANCE_MIDPOINTTb4b4b4) Te6edf3ColorTb4b4b4.Te6edf3Black Tff7b72else Te6edf3ColorTb4b4b4.Te6edf3White

Tff7b72private Tff7b72const Tff7b72val Te6edf3LUMINANCE_MIDPOINT Tff7b72= T79c0ff0.5f

Served by rngit 1.5.0 - Generated in 0.1s